/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

/**
 *
 * @author James
 */
@Entity
public class TCubeRole implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    private Integer id;
    private String  name;
    private String  description;
    @ManyToMany
    private List<TCubePrivilege> listOfPrivileges;
    
    public TCubeRole() {
        listOfPrivileges = new ArrayList<TCubePrivilege>();
    }
    
    public void createTCubeRole(String name, String description) {
        this.name        = name;
        this.description = description;
    }

    //Getters and Setters
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<TCubePrivilege> getListOfPrivileges() {
        return listOfPrivileges;
    }

    public void setListOfPrivileges(List<TCubePrivilege> listOfPrivileges) {
        this.listOfPrivileges = listOfPrivileges;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TCubeRole)) {
            return false;
        }
        TCubeRole other = (TCubeRole) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Roles[ id=" + id + " ]";
    }
    
}
